﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Devonline.Identity;

/// <summary>
/// 用户
/// </summary>
[DisplayName("用户")]
public class UserViewModel : UserViewModel<string>, IIdentity, IViewModel, IEntitySet
{
    /// <summary>
    /// 通用附件集合, NotMapped 用于记录实体对象上上传的附件
    /// </summary>
    [NotMapped]
    public virtual ICollection<Attachment> Attachments { get; set; }
}

/// <summary>
/// 用户
/// </summary>
/// <typeparam name="TKey">主键类型</typeparam>
[DisplayName("用户")]
public class UserViewModel<TKey> : IdentityViewModel<TKey>, IIdentity<TKey>, IViewModel<TKey>, IEntitySet<TKey> where TKey : IConvertible
{
    [Unique, DisplayName("用户名"), MaxLength(256), Excel]
    public string UserName { get; set; }
    [DisplayName("手机号码"), MaxLength(256), Excel]
    public string PhoneNumber { get; set; }
    [DisplayName("邮箱"), MaxLength(256), Excel]
    public string Email { get; set; }
    [DisplayName("用户级别编号"), MaxLength(36), Excel]
    public TKey LevelId { get; set; }
}